package api

import (
	"github.com/gin-gonic/gin"
	"send-id-num/internal/handler"
	"send-id-num/pkg/middleware"

	"send-id-num/pkg/logger"
)

func InitRouter() *gin.Engine {
	gin.SetMode(gin.ReleaseMode)
	router := gin.New()
	l := logger.New()
	router.Use(
		middleware.LoggerMiddleware(l),
		gin.Recovery(),
	)

	apiGroup := router.Group("/api/:source")
	apiGroup.POST("/login", handler.Login)
	apiGroup.GET("/detail", handler.Detail)
	apiGroup.POST("/sign", handler.SignIn)

	return router
}
